package com.sww.pj.sys.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.sww.pj.common.pojo.JsonResult;
import com.sww.pj.sys.pojo.SysMenu;
import com.sww.pj.sys.service.SysMenuService;

/**	菜单功能的实现	 */
@RequestMapping("/menu/")
@RestController
public class SysMenuController {
	
	@Autowired
	private SysMenuService sysMenuService;
	
	//查询菜单信息
	@RequestMapping("doFindObjects")
	public JsonResult doFindObjects() {
		return new  JsonResult(sysMenuService.findObjects());
	}
	//删除菜单信息
	@RequestMapping("doDeleteObject")
	public JsonResult doDeleteObject(Integer id){
		sysMenuService.deleteObject(id);
		return new JsonResult("删除成功");
	}
	//树结构的实现
	@RequestMapping("doFindZtreeMenuNodes")
	public JsonResult doFindZtreeMenuNodes(){
		return new JsonResult(
				sysMenuService.findZtreeMenuNodes());
	}
	//新增菜单项
	@RequestMapping("doSaveObject")
	public JsonResult doSaveObject(SysMenu entity){
		sysMenuService.saveObject(entity);
		return new JsonResult("提交成功");
	}
	//修改菜单信息
	@RequestMapping("doUpdateObject")
	public JsonResult doUpdateObject(
			SysMenu entity){
		sysMenuService.updateObject(entity);
		return new JsonResult("修改成功");
	}
}
